home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 February: Tool Chest / Apple Developer CD Series Tool Chest February 1996 (Apple Computer)(1996).iso / Sample Code / AppsToGo / DTS.Draw / TRootObj.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-09-22  |  2.7 KB  |  121 lines  |  [TEXT/MPS ]

  1. /*
  2. ** Apple Macintosh Developer Technical Support
  3. **
  4. ** File:        TRootObj.c
  5. ** Written by:    Eric Soldan
  6. **
  7. ** Copyright © 1992 Apple Computer, Inc.
  8. ** All rights reserved.
  9. */
  10.  
  11. /* You may incorporate this sample code into your applications without
  12. ** restriction, though the sample code has been provided "AS IS" and the
  13. ** responsibility for its operation is 100% yours.  However, what you are
  14. ** not permitted to do is to redistribute the source as "DSC Sample Code"
  15. ** after having made changes. If you're going to re-distribute the source,
  16. ** we require that you make it clear in the source that the code was
  17. ** descended from Apple Sample Code, but that you've made changes. */
  18.  
  19. /* See the files "=How to write your app" and "=Using TreeObj.c" for information
  20. ** on this function. */
  21.  
  22.  
  23.  
  24. /*****************************************************************************/
  25.  
  26.  
  27.  
  28. #include "App.h"            /* Get the application includes/typedefs, etc.    */
  29. #include "App.protos.h"        /* Get the prototypes for the application.        */
  30.  
  31. #ifndef __OSEVENTS__
  32. #include <OSEvents.h>
  33. #endif
  34.  
  35. #ifndef __OSUTILS__
  36. #include <OSUtils.h>
  37. #endif
  38.  
  39. #ifndef __QUICKDRAW__
  40. #include <Quickdraw.h>
  41. #endif
  42.  
  43. #ifndef __TREEOBJ2__
  44. #include "TreeObj2.h"
  45. #endif
  46.  
  47. #ifndef __UTILITIES__
  48. #include "Utilities.h"
  49. #endif
  50.  
  51.  
  52.  
  53. /*****************************************************************************/
  54.  
  55.  
  56.  
  57. static RootObjPeek    *gMWERKSDebug;
  58.     /* For Metroweks debugging of AppsToGo "objects", you need an instance of the
  59.     ** same type you wish to view it in the debugger.  Now we have an instance. */
  60.  
  61.  
  62.  
  63. /*****************************************************************************/
  64. /*****************************************************************************/
  65.  
  66. #ifdef applec
  67. #pragma segment DTSDrawSeg2
  68. #endif
  69.  
  70. /*****************************************************************************/
  71. /*****************************************************************************/
  72.  
  73.  
  74.  
  75. long    TRootObj(TreeObjHndl hndl, short message, long data)
  76. {
  77.     short    fileRefNum;
  78.     char    *cptr;
  79.  
  80.     switch (message) {
  81.         case FREADMESSAGE:
  82.             fileRefNum = data;
  83.             return(ReadTreeObjData(hndl, fileRefNum));
  84.             break;
  85.  
  86.         case FWRITEMESSAGE:
  87.             fileRefNum = data;
  88.             return(WriteTreeObjData(hndl, fileRefNum));
  89.             break;
  90.  
  91.         case HREADMESSAGE:
  92.             return(HReadTreeObjData(hndl, (Handle)data));
  93.             break;
  94.  
  95.         case HWRITEMESSAGE:
  96.             return(HWriteTreeObjData(hndl, (Handle)data));
  97.             break;
  98.  
  99.         case VHMESSAGE:
  100. #if VH_VERSION
  101.             cptr = ((VHFormatDataPtr)data)->data;
  102.             ccatchr(cptr, 13, 2);
  103.             VHRootInfo(hndl, cptr);
  104.             ccat   (cptr, "  $08: numSelected = ");
  105.             ccatdec(cptr, mDerefRoot(hndl)->numSelected);
  106.             ccatchr(cptr, 13, 2);
  107.             VHFileRecInfo(hndl, cptr);
  108.             return(true);
  109. #endif
  110.             break;
  111.  
  112.         default:
  113.             break;
  114.     }
  115.  
  116.     return(noErr);
  117. }
  118.  
  119.  
  120.  
  121.